def getMajority(nums, left, right):
    if left == right:
        return nums[left]
    mid = left + (right - left) // 2
    left_majority = getMajority(nums, left, mid)
    right_majority = getMajority(nums, mid + 1, right)
    if left_majority == right_majority:
        return left_majority
    left_count = 0
    right_count = 0
    for i in nums[left:right]:
        if i == left_majority:
            left_count += 1
        elif i == right_majority:
            right_count += 1
    if left_count < right_count:
        return right_majority
    else:
        return left_majority


nums = [3, 3, 4]
print(getMajority(nums, 0, len(nums) - 1))
